
export interface DomFormField {
  id: string;
  name?: string | null;
  label?: string | null;
  component?: string;
  type: 'input' | 'select' | 'radio' | 'radio-group' | 'checkbox' | 'checkbox-group' | 'switch' | 'custom' | 'textarea' | 'date' | 'time' | 'datetime' | 'number' | 'password' | 'file';
  options?: Option[];
  switchOption?: SwitchOption;
}

export interface FillStrategy {
  /**
   *
   * @param el form-item
   */
  canHandle(el: HTMLElement): boolean;

  /**
   *
   * @param el form-item
   */
  describe(el: HTMLElement): DomFormField;

  /**
   *
   * @param el form-item
   * @param value
   */
  fill(el: HTMLElement, value: any): void;

  /**
   * query html input element with form-item
   * @param el
   */
  queryHTMLInputElement(el: HTMLElement): HTMLInputElement | NodeListOf<HTMLInputElement>;

  /**
   * query form-item label with form-item
   * @param el
   */
  queryFormItemLabel(el: HTMLElement): HTMLElement;

}

export interface Option {
  key?: string;
  id?: string;
  label: string;
  value?: string | null | undefined;
  name?: string | null | undefined;
}

export interface SwitchOption {
  trueValue: boolean | string | null | undefined;
  falseValue: boolean | string | null | undefined;
}

export interface OptionsStrategy extends FillStrategy {
  parseOptions(el: HTMLElement): Option[] | Option | SwitchOption;
}


/**
 * 装饰器位置
 */
// direction.ts
export const Direction = {
  Up: 'UP',
  Down: 'DOWN',
  Left: 'LEFT',
  Right: 'RIGHT',
} as const

export type Direction = typeof Direction[keyof typeof Direction]
